<script lang="ts" setup>
import { useRouter } from 'vue-router';
import largeScreenDetails from './largeScreenDetails.vue';
import { useDataScreenListStore } from '@/store/modules/dcp/enginee_certification/dataScreenList';

const router = useRouter();
function gotoScreen() {
  router.push('/screen');
}
const cLackTotal = ref<number>(0);
const pLackTotal = ref<number>(0);
const eLackTotal = ref<number>(0);
const allData = ref<any[]>([]);
async function getAllData() {
  await useDataScreenListStore().getData();
  allData.value = useDataScreenListStore().getAllData();
}
onMounted(async () => {
  await getAllData();
  cLackTotal.value = allData.value.filter((item: any) => item.isRdCommon === 0).length;
  pLackTotal.value = allData.value.filter((item: any) => item.isRdProfession === 0).length;
  eLackTotal.value = allData.value.filter((item: any) => item.rdExperienceLevel === '研发经验L0').length;
});
</script>

<template>
  <PubPageMain class="max">
    <div class="header">
      <div class="left">
        <a-space>
          <div class="pjTitle">
            研发人员认证情况
          </div>
        </a-space>
      </div>
      <div class="right">
        <a-space>
          <a-button type="primary" @click="gotoScreen">
            查看大屏
          </a-button>
        </a-space>
      </div>
    </div>
    <div class="content">
      <div class="statistics">
        <div>
          <a-row>
            <a-col :span="8">
              <a-statistic title="通用认证级别缺失人数" :value="cLackTotal" style="margin-left: 150px;" />
            </a-col>
            <a-col :span="8">
              <a-statistic title="专业认证级别缺失人数" :value="pLackTotal" />
            </a-col>
            <a-col :span="8">
              <a-statistic title="经验认证级别缺失人数" :value="eLackTotal" style="margin-right: 150px;" />
            </a-col>
          </a-row>
        </div>
        <a-divider />
        <largeScreenDetails />
      </div>
    </div>
  </PubPageMain>
</template>

<style lang="scss" scoped>
.max {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  max-height: 95%;
  overflow: auto;

  .header {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 40px;
    margin-bottom: 10px;
    background-color: #fff;

    .pjTitle {
      padding-left: 15px;
      background: url("@/assets/images/title-left-bg.svg") no-repeat;
    }

    .right {
      display: flex;
      align-items: center;
    }
  }

  .editable-row-operations a {
    margin-right: 8px;
  }

  .content {
    display: flex;
    flex: 1;
    flex-direction: column;
    width: 100%;
    height: 95%;
    overflow: auto;
    text-align: center;

    .statistics {
      width: 100%;

      .pjContent {
        display: flex;
        justify-content: center;
        width: 100%;

        .pjItem {
          display: flex;
          width: 25%;
          height: 128px;
          margin: 0 6px;
          margin: 10px 0 10px 0;
          background-image: linear-gradient(65deg, #fafcff 0%, #f4f7ff 100%);

          .pjItem-left {
            flex: 1;
          }

          .pjItem-name {
            padding: 26px 0 0 0;
            font-family: PingFangSC-Medium;
            font-size: 18px;
            font-weight: 500;
            color: #151e26;
            text-align: center;
          }

          .pjItem-num {
            padding: 8px 0 0 0;
            font-family: PingFangSC-Regular;
            font-size: 16px;
            font-weight: 400;
            color: #8a8e92;
            text-align: center;

            .big {
              padding-right: 6px;
              font-family: DINEngschrift-Alternate;
              font-size: 32px;
              font-weight: Alternate;
              color: #151e26;
            }
          }
        }
      }
    }
  }
}
</style>
